﻿@namespace MudBlazor.UnitTests.TestComponents

<MudSwipeArea @ref="_swipeArea" OnSwipeEnd="HandleSwipeEnd" Style="width: 100%; height: 300px" Sensitivity="_sensitivity" PreventDefault="@_preventDefault">
    <MudText Typo="@Typo.body1">@($"{SwipeDirection} - Swiped: {SwipeDelta}px")</MudText>
    </MudSwipeArea>
<MudSwitch @bind-Value="@_preventDefault" Color="Color.Primary">Prevent Default</MudSwitch>
    <MudNumericField @bind-Value="_sensitivity" Label="Sensitivity" Min="0" />

    @code {
    MudSwipeArea _swipeArea;

    bool _preventDefault = true;
    int _sensitivity = 100;

    [Parameter]
    public SwipeDirection SwipeDirection { get; set; }

    [Parameter]
    public double? SwipeDelta { get; set; }

    private void HandleSwipeEnd(SwipeEventArgs args)
    {
        SwipeDirection = args.SwipeDirection;
        SwipeDelta = args.SwipeDelta;
    }
}